﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Runtime.InteropServices;

using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swcommands;
using SolidWorks.Interop.swconst;
using SolidWorks.Interop.swpublished;

using SwAddinHelpers.Contracts;
using SwAddinHelpers.Base;

namespace SwAddinHelpers.PropertyManager
{
    [ComVisible(true)]
    public sealed class PropertyManagerHandler: PropertyManagerPage2Handler7
    {
        private PropertyManagerHost _OwnerHost;

        public PropertyManagerHandler(PropertyManagerHost parent)
        {
            _OwnerHost = parent;
        }

        public void AfterActivation()
        {

        }

        public void AfterClose()
        {
            //This function must contain code, even if it does nothing, to prevent the
            //.NET runtime environment from doing garbage collection at the wrong time.
            int IndentSize;
            IndentSize = System.Diagnostics.Debug.IndentSize;
            System.Diagnostics.Debug.WriteLine(IndentSize);
        }

        public int OnActiveXControlCreated(int Id, bool Status)
        {
            if (Status)
            {
                _OwnerHost.GuiControl = (UserControlBase)_OwnerHost.PropertyManagerControlActiveX.GetControl();
                _OwnerHost.GuiControl.SetOwner = _OwnerHost;
                _OwnerHost.IsControlCreated = true;
            }
            else
            {
                _OwnerHost.IsControlCreated = false;
                MessageBox.Show("Failed to create PropertyManagerControl !");
            }

            return 2;
        }

        public void OnButtonPress(int Id)
        {

        }

        public void OnCheckboxCheck(int Id, bool Checked)
        {

        }

        public void OnClose(int Reason)
        {
            //This function must contain code, even if it does nothing, to prevent the
            //.NET runtime environment from doing garbage collection at the wrong time.
            int IndentSize;
            IndentSize = System.Diagnostics.Debug.IndentSize;
            System.Diagnostics.Debug.WriteLine(IndentSize);
        }

        public void OnComboboxEditChanged(int Id, string Text)
        {

        }

        public void OnComboboxSelectionChanged(int Id, int Item)
        {

        }

        public void OnGroupCheck(int Id, bool Checked)
        {

        }

        public void OnGroupExpand(int Id, bool Expanded)
        {

        }

        public bool OnHelp()
        {
            return true;
        }

        public bool OnKeystroke(int Wparam, int Message, int Lparam, int Id)
        {
            return true;
        }

        public void OnListboxSelectionChanged(int Id, int Item)
        {

        }

        public bool OnNextPage()
        {
            return true;
        }

        public void OnNumberboxChanged(int Id, double Value)
        {

        }

        public void OnOptionCheck(int Id)
        {

        }

        public void OnPopupMenuItem(int Id)
        {

        }

        public void OnPopupMenuItemUpdate(int Id, ref int retval)
        {

        }

        public bool OnPreview()
        {
            return true;
        }

        public bool OnPreviousPage()
        {
            return true;
        }

        public void OnRedo()
        {

        }

        public void OnSelectionboxCalloutCreated(int Id)
        {

        }

        public void OnSelectionboxCalloutDestroyed(int Id)
        {

        }

        public void OnSelectionboxFocusChanged(int Id)
        {

        }

        public void OnSelectionboxListChanged(int Id, int Count)
        {

        }

        public void OnSliderPositionChanged(int Id, double Value)
        {

        }

        public void OnSliderTrackingCompleted(int Id, double Value)
        {

        }

        public bool OnSubmitSelection(int Id, object Selection, int SelType, ref string ItemText)
        {
            return true;
        }

        public bool OnTabClicked(int Id)
        {
            return true;
        }

        public void OnTextboxChanged(int Id, string Text)
        {

        }

        public void OnUndo()
        {

        }

        public void OnWhatsNew()
        {

        }

        public void OnGainedFocus(int Id)
        {
            
        }

        public void OnLostFocus(int Id)
        {
            
        }
    }
}
